<?php
/**
 * View Archivio Post LaFabbrica.org
 * 
 * @author     luigi.pastore (gigi@la-fabbrica.org)
 * @created    21-apr-2011
 * @package    LaFabbrica
 * @copyright  Copyright (c) 2011 Luigi Pastore
 */
?>
<script type="text/javascript">
    //<![CDATA[

    $(document).ready(function(){
	var pagination = $('#contacts').pagination({
	    'targetUrl' : '/admin/ajax/list/contacts',
	    'orderField' : 'contact_name',
	    'orderDir' : 'asc'
	});

        $( "#searchField" ).keyup( function() {
            if($(this).val().length >= 3)
            {
                var pagination = $('#contacts').pagination({
                    'targetUrl' : '/admin/search/contacts/'+ $(this).val(),
                    'orderField' : 'contact_name',
                    'orderDir' : 'asc',
                    'perPage' : 2
                });
            }
            else if($(this).val().length == 0)
            {
                var pagination = $('#contacts').pagination({
                    'targetUrl' : '/admin/ajax/list/contacts',
                    'orderField' : 'contact_name',
                    'orderDir' : 'asc'
                });                
            }
        });
    });

    //]]>
</script>
<div class="info">
    <h2>Rubrica Contatti</h2>
    <div>Per inserire un nuovo locale...</div>
</div>

<form>
    <ul>
	<li class="addnew">
	    <a class="button" href="info">
		<img src="/images/admin/16x16/add-new.png" />Nuovo Contatto
	    </a>
	</li>
	<li id="fo2li107" class="likert col3">
	    <table cellspacing="0">
		<caption id="title107">
		    Tot: <strong><?php echo $this->count_contacts ?></strong> elementi presenti in Rubrica.
                    <div class="searchBox">
                        <label class="search">Cerca</label>
                        <input class="search" id="searchField" class="text" type="search" value="">
                    </div>
		</caption>
		<thead>
		    <tr>
			<td colspan="3" class="pagination">
			    <div class="paginator">
				<span class="prev">
				    <a href="javascript: void(0);">&nbsp;</a>
				</span>

				<span class="loader">Sto caricando...</span>
				<span class="next">
				    <a href="javascript: void(0);">&nbsp;</a>
				</span>
			    </div>
			</td>
		    </tr>		    
		    <tr>
			<th class="sortable default {ref: 'contact_name'}">Nome</th>
			<td colspan="2">&nbsp;</td>
		    </tr>
		</thead>
		<tbody id="contacts">
		    <!-- Questo contenuto verrà rimpiazzato dalla paginazione-->
		</tbody>
		<tfoot>
		    <tr>
			<td colspan="3" class="pagination">
			    <div class="paginator">
				<span class="prev">
				    <a href="javascript: void(0);">&nbsp;</a>
				</span>
				<div class="pagercontainer">

				</div>
				<span class="next">
				    <a href="javascript: void(0);">&nbsp;</a>
				</span>
			    </div>
			</td>
		    </tr>
		</tfoot>
	    </table>
	</li>
    </ul>
</form>
